/*
 * driver.c
 *
 * Created: 12/17/2012 12:17:26 PM
 *  Author: duerk@msoe.edu <Kevin Duer>
 *			zimmermane@msoe.edu <Evan Zimmerman>
 *			woottons@msoe.edu <Scott Wootton>
 *	
 * 
 * Purpose: This main file for the design
*/

#include <stdio.h>
#include <string.h>
#include "uart.h"
#include "transmission.h"

// set up file for I/O operations
FILE uart_str = FDEV_SETUP_STREAM(uart_putc,uart_getc,_FDEV_SETUP_RW);

int main (void){

	// init text buffer to size 80
	char text[MAX_BUFFER_SIZE];

	//SET BAUD RATE = 9600
	uart_init(103);
	initTx();
	// make getc and putc the standard in and standard out
	stdout = stdin = &uart_str;
	
	// print out system ready prompt
	fprintf(stdout,"System Ready. You Are Now Connected.\n\n");

	while(1){
		fgets(text,MAX_BUFFER_SIZE, stdin);	
		volatile int i = 0;
		while(text[i] != '\0')
		{
			if((text[i] != '\r') && (text[i] != '\n'))
			  sendNetworkChar(text[i]);
			//uart_putc(text[i]);
			i++;
		}
	}
}
